home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C18 / Makemain.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  774 b   |  31 lines

  1. //: C18:Makemain.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // Create a shell main() file
  7. #include "../require.h"
  8. #include <fstream>
  9. #include <strstream>
  10. #include <cstring>
  11. #include <cctype>
  12. using namespace std;
  13.  
  14. int main(int argc, char* argv[]) {
  15.   requireArgs(argc, 1);
  16.   ofstream mainfile(argv[1]);
  17.   assure(mainfile, argv[1]);
  18.   istrstream name(argv[1]);
  19.   ostrstream CAPname;
  20.   char c;
  21.   while(name.get(c))
  22.     CAPname << char(toupper(c));
  23.   CAPname << ends;
  24.   mainfile << "//" << ": " << CAPname.rdbuf()
  25.     << " -- " << endl
  26.     << "#include <iostream>" << endl
  27.     << endl
  28.     << "main() {" << endl << endl
  29.     << "}" << endl;
  30. } ///:~
  31.